home *** CD-ROM | disk | FTP | other *** search
- /*
- * The original copyright owners of the accompanying source code files have
- * agreed to place such code into the public domain. Accordingly, anyone
- * who receives or obtains a copy of such source code is freely entitled to
- * reproduce, use and otherwise exploit such code (including the right to
- * make derivative works), at his/her own risk and expense, without any
- * obligation or liability to the original copyright owners.
- *
- * We would appreciate (but do not require) that the following message be
- * included in any derivative works:
- *
- * "Portions of this program were developed by Peter Broadwell, Rob Myers
- * and Robin Schaufler while working in Silicon Valley."
- *
- * The accompanying source code files and related documentation materials
- * are distributed on an "AS IS" basis, without any warranties or
- * guarantees of any kind. All implied warranties, including the implied
- * warranties of merchantability and of fitness for any particular purpose,
- * are expressly disclaimed.
- */
- #include "gl.h"
- #include "geom.h"
- #include "selectors.h"
- #include "class.h"
- #include "classIds.h"
- #include "mbox.h"
- #include "individual.h"
- #include "behavior.h"
- #include "doers.h"
-
- #include "camera.h"
-
- extern class indivClass;
- model cameraBody, cameraLenz;
-
- extern char *take(), *leftright(), *updown(), *inout(), *zoom();
- extern char *getMouse(), *home();
-
- fcnTable cameraTable[] = {
- TAKE, take,
- LEFTRIGHT, leftright, /* turn (relative to observer) */
- UPDOWN, updown,
- INOUT, inout,
- ZOOM, zoom, /* adjust the focal length */
- POLL, getMouse,
- HOME, home, /* restore default viewing parameters */
- EOTABLE,
- };
-
- class cameraClass = {
- &indivClass,
- cameraTable,
- sizeof(camera),
- CAMERA,
- };
-
- camera cameraTemplate = {
- /* inst */
- &cameraClass, /* myClass pointer */
- NULL, /* classFunctions */
- 0, /* nFunctions */
- /* mailbox */
- NULL, /* subscribers */
- NULL, /* subscribedTo */
- /* individual */
- {10000,10000,10000},/* position */
- {0,0,0}, /* lastPosition */
- {1,0,0}, /* delta */
- {0,0,0}, /* velocity */
- {0,0,0}, /* avelocity */
- {0,0,0}, /* acceleration */
- 1.0, /* speed */
- {0,0,10}, /* heading */
- {0,900,0}, /* rotation */
- {0,0,0}, /* influence */
- 1.0, /* scale */
- &cameraBody, /* model */
- TRUE, /* flags */
- NULL, /* curVars */
- NULL, /* controls */
- /* camera */
- 900, /* focal length (zoom) */
- };
-
- point cameraBodyPoints[] = {
- { 0, 0, 0, }, /* gratuitous vertex 0 */
- { 300, 150, 150, },
- { 300, -150, 150, },
- { 300, -150, -150, },
- { 300, 150, -150, },
- { -300, 150, 150, },
- { -300, -150, 150, },
- { -300, -150, -150, },
- { -300, 150, -150, },
- };
-
- point cameraLenzPoints[] = {
- { 0, 0, 0, }, /* gratuitous vertex 0 */
- { 300, 0, 30, },
- { 300, -30, 0, },
- { 300, 0, -30, },
- { 300, 30, 0, },
- { 400, 0, 40, },
- { 400, -40, 0, },
- { 400, 0, -40, },
- { 400, 40, 0, },
- };
- /* null terminated polys, double null at end */
- long cameraBodyVertices[] = {
- 1,2,3,4,0,
- 1,4,8,5,0,
- 1,5,6,2,0,
- 2,6,7,3,0,
- 4,3,7,8,0,
- 5,8,7,6,0,
- 0,
- };
- long cameraLenzVertices[] = {
- 1,5,8,4,0,
- 4,8,7,3,0,
- 3,7,6,2,0,
- 2,6,5,1,0,
- 0,
- };
-
- extern model cameraBody;
-
- model cameraLenz = {
- NULL, /* next model segment */
- NULL, /* child model segment */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- cameraLenzPoints, /* point dictionary */
- cameraLenzVertices, /* polygon descriptions */
- { 350,0,0}, /* centroid */
- 0, /* color */
- 0, /* texture */
- FALSE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 0, /* declasse */
- };
-
- model cameraBody = {
- &cameraLenz, /* next model segment */
- NULL, /* child model segment */
- 0, /* geometry compiled yet? */
- 0, /* compiled geometry object Id */
- cameraBodyPoints, /* point dictionary */
- cameraBodyVertices, /* polygon descriptions */
- { 0,0,0}, /* centroid */
- 0, /* color */
- 0, /* texture */
- FALSE, /* outlined */
- { 0,0,0}, /* rotation */
- { 0,0,0}, /* translation */
- { 1.0,1.0,1.0}, /* scale */
- 0, /* declasse */
- };
-
-